//
//  District.m
//  08_Work
//
//  Created by dllo on 16/7/12.
//  Copyright © 2016年 yh. All rights reserved.
//

#import "District.h"

@implementation District
- (instancetype)initWithName:(NSString *)name {
    return [self initWithName:name number:nil];
}

+ (instancetype)districtWithName:(NSString *)name {
    return [[self alloc] initWithName:name number:nil];
}

- (instancetype)initWithName:(NSString *)name number:(NSString *)number {
    self = [super init];
    if (self) {
        _name = [name copy];
        _number = [number copy];
    }
    return self;
}

+ (instancetype)districtWithName:(NSString *)name number:(NSString *)number {
    return [[[self alloc] initWithName:name number:number] autorelease];
}

- (instancetype)initWithTempCity:(TempCity *)tempCity {
    return [self initWithName:tempCity.name number:tempCity.number];
}

+ (instancetype)districtWithTempCity:(TempCity *)tempCity {
    return [[[self alloc] initWithTempCity:tempCity] autorelease];
}
- (NSString *)description {
    return [NSString stringWithFormat:@"%@", _name];
}
//- (NSString *)description {
//    return [NSString stringWithFormat:@"%@ %@", _name, _number];
//}

- (void)dealloc {
    [_name release];
    [_number release];
    [super dealloc];
}

@end
